import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)


export default new Vuex.Store({
  state: {
    nodeMap: new Map(),
    isEdit: null,
    selectedNode: {},
    selectFormItem: null,
    design:{},
  },
  mutations: {
    setIsEdit(state, val){
      state.isEdit = val
    },
    selectedNode(state, selectedNode) {
      state.selectedNode = selectedNode
    },
    // 初始化表单数据
    loadForm(state, design){
      state.design = design
    },
    // 设置表单元素
    setFormItems(state, formItems){
      state.design.formItems = formItems
    },
  },
  getters: {},
  actions: {},
  modules: {}
})
